using FluentNHibernate.Mapping;
using Subfaculty.Common.Entities;

namespace Subfaculty.Infrastructure.Repositories.Mapping
{
	public class StudyPlanSemesterMapping : ClassMap<StudyPlanSemester>
	{
		public StudyPlanSemesterMapping()
		{
			Id(x => x.Id).GeneratedBy.Identity();

			References(x => x.StudyPlan, "StudyPlanId").Cascade.SaveUpdate();
			HasMany(x => x.StudyPlanItems).KeyColumn("StudyPlanSemestersId").Cascade.AllDeleteOrphan();
			Map(x => x.Number);
			Map(x => x.Duration);
		}
	}
}